package light.head.model.inv;

import java.io.Serializable;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.hibernate.annotations.Formula;

/**
 * 入库明细
 * @author yy
 *
 */
@Entity
@Table
public class InvInStorageItem implements Serializable{
	private static final long serialVersionUID = 9067253654842857779L;
	
	private Integer code;
	private Integer iisc;				// 入库编号
	private Integer cc;					// 商品编号
	private Integer number;				// 入库数量
	private Double price;				// 入库单价
	
	private Integer dc;					// 仓库编号

	private String remark;				// 备注
	private Boolean deleted = false;	// 是否删除
	private Byte snc;					// 序列号状态 (1.没有序列号 2.一类序列号 3.唯一序列号)
	
	private String dname;				// 仓库名称
	private String cname;
	private String un;					// 单位
	private List<InvInStorageDetail> detailList;
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column
	public Integer getCode() {
		return code;
	}
	@Column
	public Integer getIisc() {
		return iisc;
	}
	@Column
	public Integer getCc() {
		return cc;
	}
	@Column
	public Integer getNumber() {
		return number;
	}
	@Column
	public Integer getDc() {
		return dc;
	}

	@Column
	public String getRemark() {
		return remark;
	}
	@Column
	public Boolean getDeleted() {
		return deleted;
	}
	@Column
	public Double getPrice() {
		return price;
	}
	@Formula("(SELECT c.snc FROM InvCommodityItem c WHERE c.code = cc)")
	public Byte getSnc() {
		return snc;
	}
	@Formula("(SELECT c.name FROM InvCommodityInfo c WHERE c.code IN (SELECT ci.cc FROM InvCommodityItem ci WHERE ci.code = cc))")
	public String getCname() {
		return cname;
	}
	@Formula("(SELECT c.name FROM InvUnit c WHERE c.code IN (SELECT ci.uc FROM InvCommodityItem ci WHERE ci.code = cc))")
	public String getUn() {
		return un;
	}
	
	@Formula("(SELECT d.name FROM InvDepot d WHERE d.code = dc)")
	public String getDname() {
		return dname;
	}
	@Transient
	public List<InvInStorageDetail> getDetailList() {
		return detailList;
	}
	
	
	
	
	
	public void setUn(String un) {
		this.un = un;
	}
	
	public void setCname(String cname) {
		this.cname = cname;
	}
	public void setDetailList(List<InvInStorageDetail> detailList) {
		this.detailList = detailList;
	}
	public void setSnc(Byte snc) {
		this.snc = snc;
	}
	public void setPrice(Double price) {
		this.price = price;
	}
	public void setDeleted(Boolean deleted) {
		this.deleted = deleted;
	}
	public void setCode(Integer code) {
		this.code = code;
	}
	public void setIisc(Integer iisc) {
		this.iisc = iisc;
	}
	public void setCc(Integer cc) {
		this.cc = cc;
	}
	public void setNumber(Integer number) {
		this.number = number;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}
	public void setDc(Integer dc) {
		this.dc = dc;
	}
	public void setDname(String dname) {
		this.dname = dname;
	}
	
	
	
 }
